background-gradient-end: #74a0d0;
}
+.login-dialog-message-warning {
+ color: orange;
+}
+
.unlock-dialog-user-name-container {
spacing: .4em;
}
this._userVerifier = new GdmUtil.ShellUserVerifier(this._greeterClient);
this._userVerifier.connect('ask-question', Lang.bind(this, this._askQuestion));
- this._userVerifier.connect('verification-failed', Lang.bind(this, this._onVerificationFailed));
+ this._userVerifier.connect('show-message', Lang.bind(this, this._showMessage));
this._userVerifier.connect('reset', Lang.bind(this, this._onReset));
this._userVerifier.connect('show-login-hint', Lang.bind(this, this._showLoginHint));
x_fill: true,
y_fill: false,
x_align: St.Align.START });
+
+ this._promptMessage = new St.Label({ visible: false });
+ this._promptBox.add(this._promptMessage, { x_fill: true });
+
this._promptLoginHint = new St.Label({ style_class: 'login-dialog-prompt-login-hint-message' });
this._promptLoginHint.hide();
this._promptBox.add(this._promptLoginHint);
},
_onReset: function(client, serviceName) {
+ this._promptMessage.hide();
+
let tasks = [this._hidePrompt,
new Batch.ConcurrentBatch(this, [this._fadeInTitleLabel,
this._sessionList.setActiveSession(sessionId);
},
+ _showMessage: function(userVerifier, message, styleClass) {
+ this._promptMessage.text = message;
+ this._promptMessage.styleClass = styleClass;
+ GdmUtil.fadeInActor(this._promptMessage);
+ },
+
_showLoginHint: function(verifier, message) {
this._promptLoginHint.set_text(message)
GdmUtil.fadeInActor(this._promptLoginHint);
}));
},
- _onVerificationFailed: function() {
- this._userVerifier.cancel();
- },
-
_onNotListedClicked: function(user) {
let tasks = [function() {
return this._userList.hideItems();
const Gio = imports.gi.Gio;
const Lang = imports.lang;
+const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Batch = imports.gdm.batch;
const FINGERPRINT_AUTHENTICATION_KEY = 'enable-fingerprint-authentication';
const BANNER_MESSAGE_KEY = 'banner-message-enable';
const BANNER_MESSAGE_TEXT_KEY = 'banner-message-text';
+const ALLOWED_FAILURES_KEY = 'allowed-failures';
const LOGO_KEY = 'logo';
this._fprintManager = new Fprint.FprintManager();
this._realmManager = new Realmd.Manager();
+
+ this._failCounter = 0;
},
begin: function(userName, hold) {
// to indicate the user can swipe their finger instead
this.emit('show-login-hint', _("(or swipe finger)"));
} else if (serviceName == PASSWORD_SERVICE_NAME) {
- Main.notifyError(info);
+ this.emit('show-message', info, 'login-dialog-message-info');
}
},
// users who haven't enrolled their fingerprint.
if (serviceName != PASSWORD_SERVICE_NAME)
return;
- Main.notifyError(problem);
+ this.emit('show-message', problem, 'login-dialog-message-warning');
},
_showRealmLoginHint: function() {
},
_onReset: function() {
- this._userVerifier.run_dispose();
- this._userVerifier = null;
+ this.clear();
+
+ // Clear previous attempts to authenticate
+ this._failCounter = 0;
this.emit('reset');
},
this.emit('verification-complete');
},
+ _verificationFailed: function() {
+ // For Not Listed / enterprise logins, immediately reset
+ // the dialog
+ // Otherwise, we allow ALLOWED_FAILURES attempts. After that, we
+ // go back to the welcome screen.
+
+ if (!this._userName ||
+ (++this._failCounter) == this._settings.get_int(ALLOWED_FAILURES_KEY)) {
+ // Allow some time to see the message, then reset everything
+ Mainloop.timeout_add(3000, Lang.bind(this, function() {
+ this.cancel();
+
+ this._onReset();
+ }));
+ } else {
+ this.clear();
+ this.begin(this._userName, new Batch.Hold());
+ }
+
+ this.emit('verification-failed');
+ },
+
_onConversationStopped: function(client, serviceName) {
// if the password service fails, then cancel everything.
// But if, e.g., fingerprint fails, still give
// password authentication a chance to succeed
if (serviceName == PASSWORD_SERVICE_NAME) {
- this.emit('verification-failed');
+ this._verificationFailed();
}
this.emit('hide-login-hint');
this._userName = GLib.get_user_name();
this._user = this._userManager.get_user(this._userName);
+ this._failCounter = 0;
+
this._greeterClient = new Gdm.Client();
this._userVerifier = new GdmUtil.ShellUserVerifier(this._greeterClient, { reauthenticationOnly: true });
- this._userVerifier.connect('reset', Lang.bind(this, this._reset));
this._userVerifier.connect('ask-question', Lang.bind(this, this._onAskQuestion));
+ this._userVerifier.connect('show-message', Lang.bind(this, this._showMessage));
this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete));
- this._userVerifier.connect('verification-failed', Lang.bind(this, this._onVerificationFailed));
+ this._userVerifier.connect('reset', Lang.bind(this, this._onReset));
this._userVerifier.connect('show-login-hint', Lang.bind(this, this._showLoginHint));
this._userVerifier.connect('hide-login-hint', Lang.bind(this, this._hideLoginHint));
this.contentLayout.add_actor(this._promptLayout);
+ this._promptMessage = new St.Label({ visible: false });
+ this.contentLayout.add(this._promptMessage, { x_fill: true });
+
this._promptLoginHint = new St.Label({ style_class: 'login-dialog-prompt-login-hint' });
this._promptLoginHint.hide();
this.contentLayout.add_actor(this._promptLoginHint);
this.setButtons([cancelButton, this._okButton]);
this._updateOkButton(false);
- this._reset();
let otherUserLabel = new St.Label({ text: _("Log in as another user"),
style_class: 'login-dialog-not-listed-label' });
{ x_align: St.Align.START,
x_fill: false });
+ let batch = new Batch.Hold();
+ this._userVerifier.begin(this._userName, batch);
+
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
this.emit('loaded');
return false;
this._okButton.button.reactive = sensitive;
},
- _reset: function() {
- this._userVerifier.clear();
- this._userVerifier.begin(this._userName, new Batch.Hold());
+ _showMessage: function(userVerifier, message, styleClass) {
+ this._promptMessage.text = message;
+ this._promptMessage.styleClass = styleClass;
+ GdmUtil.fadeInActor(this._promptMessage);
},
_onAskQuestion: function(verifier, serviceName, question, passwordChar) {
this.emit('unlocked');
},
- _onVerificationFailed: function() {
- this._userVerifier.cancel();
+ _onReset: function() {
this.emit('failed');
},
_escape: function() {
- this._onVerificationFailed();
+ this._userVerifier.cancel();
+ this.emit('failed');
},
_otherUserClicked: function(button, event) {